home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 1 Issue 2 / PDCD-1 - Issue 02.iso / _utilities / utilities / 003 / _mask / !Mask / !Help < prev    next >
Text File  |  1993-09-17  |  19KB  |  418 lines

  1. Version=1.11  You may copy this program for non-commercial reasons only.
  2. summary:
  3. !Mask is an application which allows you select certain items of a picture.
  4. For example you can isolate yellow text from a blue-ish picture. The program
  5. also offers some image processing possibilities like photomorphing.
  6. Input files are always clear or sprite files, output files are always clear
  7. files. In the clear format you have a 24 bit palette or full 24 bit color.
  8. You can translate clears<>sprites using !Translator, see below.
  9.  
  10. Main features:
  11. 1)Selecting & isolating objects in an image, based on its color, hue, etc.
  12. 2)Erasing objects in an image
  13. 3)Changing the color of objects in an image
  14. 4)Morphing one picture gradually into another
  15.  
  16. *********************************GETTING STARTED***************************
  17. Give the program as much memory as possible, but leave enough screenmemory.
  18. Press the select button over an object in the top-left window. For example
  19. the M of 'megadeth'. Than press menu in the top-left window or press it
  20. above the vertical bar. A mask will be made in about 0.6 (arm2) or
  21. 0.15 (arm3) seconds.
  22. *********************************MASKING***********************************
  23. Making masks from r,b,g values in the original image:
  24. grey:
  25.     Compares grey values of pixels and target pixel.
  26.     rule: (r+g+b)-(Tr+Tg+Tb)<d
  27. rgb:
  28.     Compares distance of the rgb vector of a pixel and target pixel.
  29.     rule: (r-Tr)▓+(g-Tg)▓+(b-Tb)▓<d▓
  30. color:
  31.     Compares 'color' of pixels. This is the best choice in most cases.
  32.     Note that masking this way will also select black (rgb=0,0,0) and
  33.     possibly other dark colors. This option is of no use to monochrome
  34.     images.
  35.     rule: v=r+g+b:t=Tr+Tg+Tb:(r*t-Tr*v)▓+(g*t-Tg*v)▓+(b*t-Tb*v)▓<d▓*v▓*t▓
  36. edge:
  37.     Tries to find edges in the picture. Rather slow.
  38.     rule: Er▓+Eg▓+Eb▓>d▓ ,with Er,Eg,Eb the edginess of a point, defined
  39.     by sobelX▓+sobelY▓.
  40. hue:
  41.     Compares color of pixels, but in another way than 'color'.
  42.     The hue of a pixel is not depending on its brightness, nor its
  43.     'whiteness'. So it may do well in overexposed images.
  44.     rule:(h(target)-h(pixel))mod (2*PI)<d , with h(r,g,b)=
  45.     arctan2(r-2/3*sqr(3)*(g+b) , 1/2*g-1/2*b). This is not (and probably
  46.     will never be) implemented for full 24 bit files.
  47.  
  48. (Tr,Tg,Tb) is the color of the target (selected) pixel.
  49.  
  50. You can activate the mask routines by pressing menu in the top-left window,
  51. or elsewere, or by selecting a new mask-button.
  52.  
  53. You can change the value of 'd' by dragging the bar in the middle of the
  54. screen. Dragging with the menu-button will start calculation immediately.
  55.  
  56. To set the target pixel, use the select-button in the top-left window.
  57.  
  58. You can make a rectangular mask by setting a rectangle with the adjust-
  59. button in the top-left window.
  60.  
  61. You can edit pixels by using menu (setting) and adjust (removing) in the
  62. down-left window.
  63.  
  64. Selecting groups:
  65.     By clicking select on a 4-connected group in the down-left window will
  66.     select this group as the current mask.
  67.     Shift-clicking select on a group that is not masked out, will remove
  68.     that group from the current mask.
  69.     Shift-clicking select on a masked out group, will add that group to the
  70.     current mask.
  71.     N.b. both groups that are in and out the mask are considered to be
  72.     groups.
  73.  
  74. *********************************MASK PROCESSING***************************
  75. binary operations:
  76.     not   :z=not x
  77.     and   :z=x and y
  78.     eor   :z=x eor y
  79.     or    :z=x or y
  80.     andnot:z=x and not y
  81.     =     :z=x
  82.     0     :z=0
  83.     1     :z=1
  84.     where z is the current mask, (yellow frame) and x and y have to be
  85.     selected, and may be equal to z.
  86.  
  87. seed x:
  88.     selects all 4-connected objects in the current mask, that are pointed
  89.     at by the pixels in mask x. There is a maximum of pixels that will be
  90.     used as seed. This operation may fail if there is not enough memory.
  91.     
  92. large x:
  93.     select all 4-connected objects in the current mask, that are thicker
  94.     (in both directions) than x.
  95.     
  96. noise x:
  97.     removes noise (pixels with less than x 8-connected neighbours)
  98.     if x=8 then this is equivalent to erodating the image.
  99.     Setting x to 3 removes all thin lines in the image.
  100.  
  101. dilation x:
  102.     adds pixel if it has at least x 8-connected neighbours.
  103.     nb. dilation(image,x)=not(noise(not image,9-x))
  104.  
  105. *********************************INPUT/OUTPUT******************************
  106. loading:
  107.     Enter a filename or enter return to abort loading.
  108.  
  109. load options:
  110.     pic     load a clear or sprite file as the main picture. All 2, 4, 16
  111.             and 256 color sprites are supported, including 256 grey-level
  112.             sprites. If no palette is given, the desktop colors are used
  113.             instead. If a sprite has a mask, this will be loaded and used
  114.             as the currently selected mask. If there is not enough memory
  115.             for the image, it can happen that the program has to quit.
  116.             Loading 2,4 and 16 color sprites may be slow.
  117.     mask    load a binary clear file as the current mask. The file has to
  118.             have the same size as the main picture.
  119.     back    replaces the masked out part of the main picture by the file
  120.             loaded. The loaded file must have the same size (x & y) as
  121.             the current picture. Currently this option works only if both
  122.             the current and loaded picture are full 24 bit images.
  123.  
  124. saving:
  125.     Enter a filename or enter return to abort saving.
  126.  
  127. save options:
  128.     pic     save whole picture (masked). Masked out parts of the picture
  129.             are replaced by the nearest color in the images palette.
  130.     smpic   make the picture as small as possible and than save it.
  131.     mask    save the current mask as a binary clear file.
  132.  
  133. *********************************IMAGE PROCESSING**************************
  134. Image processing options:
  135.  
  136. Map:
  137.     Loads a color transformation file, and than transforms the colors,
  138.     according to this file. You can make the file yourself, by editing
  139.     !Mask.GenMap
  140.     options: entering return will give you the default file:<Mask$Dir>.Maps.
  141.                                                                       Mymap
  142.              entering 'last' will give you the last used map
  143.              or enter the name of the file.
  144.              
  145. InvM:
  146.     Inverts the color of the part of the image that is in the mask.
  147.  
  148. êë:
  149.     Flips image in y-axes.
  150.  
  151. èï:
  152.     Flips image in x-axes.
  153.  
  154. 24b:
  155.     Converts paletted images to full 24 bit images. This can be useful as
  156.     some options in this program only work with 24 bit images. This operation
  157.     may destroy some masks, without warning. The masks will be compressed and
  158.     stored in the scrap-directory.
  159.  
  160. Erase:
  161.     Removes the selected part from the image. The removed part of the
  162.     image is filled up with colors, totally depending on the edge of the
  163.     mask. In some cases it is possible to remove something out of the
  164.     image without leaving visible traces. The method used for filling
  165.     up the image is Gauss-Seidel iteration. Currently a slow implementation
  166.     is used for which execution time is about equal to c*P▓ , with c
  167.     some constant depending on your machine and the shape of the mask and
  168.     P is the number of pixels involved. The calculations take place in the
  169.     smallest rectangle, surrounding the mask. If you get the message:'doing
  170.     800 iterations', the calculation will take about 3 minutes on an arm3.
  171.     So make the mask as small as possible! This works only for 24 bit
  172.     images.
  173.  
  174. Col:
  175.     Changes the color of the pixels in the mask. The resulting image will
  176.     be monochrome. Options:
  177.     C  :the new color will be the some as that of the currently selected
  178.         pixel
  179.     N  :enter values for red, green and blue. The values must a positive
  180.         number (like 0.71 or 4000)
  181.     A  :Abort operation
  182.  
  183. Grey:
  184.     Changes the grey-value of the pixels in the mask by a specified factor.
  185.  
  186. Gamma:
  187.     Performs gamma-correction on the pixels in the mask. Gamma < 1 makes
  188.     the picture darker, gamma >1 makes it lighter. Darker parts are affected
  189.     more than light parts. Rule: dest=source^(1/gamma). It can also be
  190.     used on overexposed images: First invert the image, then use 'gamma',
  191.     and invert again.
  192.     
  193. Filt:
  194.     Multiply each color-component of the pixels in the mask by the given
  195.     value. In many cases this should be preferred above the 'Col' operation.
  196.  
  197. Contrast:
  198.     Increases the contrast of the pixels in the mask, compared to the
  199.     pixels surrounding the mask. It should be used to make faint, isolated
  200.     objects in the picture better visible.
  201.  
  202. Sharp:
  203.     Makes the picture sharper. Strength should be between 0 (no effect) and
  204.     1 (strong effect), but may vary from -4 to +4. Making JPEGed pictures
  205.     sharper can give strange effects, caused by blocking. The operation
  206.     only applies on the pixels in the mask, which are not on the edge of the
  207.     picture. Don't use this on dithered pictures. Sharp -0.25 makes the
  208.     picture smooth.
  209.  
  210. Undo:
  211.     Undoes the last change made to the main picture. Note that the undo-
  212.     option must be on to have something to undo.
  213.  
  214. Morph:
  215.     Does a photomorphing on one or two images. If on two images, these
  216.     images will be mixed. If you do your best, you can get animations like
  217.     those in Micheal Jacksons video clip 'black or white'. Mixing can
  218.     be done only on two 24 bit images, of the same size. Pure morphing
  219.     however can be done on paletted images too.
  220.  
  221.     type 1: normal photomorphing on one picture:
  222.        The current picture can be either a paletted or 24 bit image.
  223.        1. First you are asked to give the filename of a secondary (clear)
  224.           picture. The only thing you can do with this picture, in type 1
  225.           morphing is view it. Just enter return if you don't want it.
  226.           The second image must have the same size (x & y) as the first and
  227.           may not have more bits per pixel.
  228.        2. If the first picture was 24 bit, and you have loaded a second
  229.           picture, you are asked if you want to interpolate, if yes, you
  230.           will be doing a type 2 morphing.
  231.        3. After that the number of steps are asked, so you can gradually
  232.           morph the picture. (and make an animation of it!)
  233.        4. If you take more than one step, there is an option to save the
  234.           generated pictures. The pictures will be saved in a directory and
  235.           be numbered 000, 001, 002, etc.
  236.        5. You are asked to load a point file. This is a file, describing
  237.           the transformation. Use this only if you have a point file for
  238.           this particular picture.
  239.        6. You are now ready to set the transformation. Press select somewhere
  240.           in the picture, (keep holding it), move the mouse and let go. The
  241.           point you just pointed at, will be moved along the line. You can use
  242.           adjust to move points around.
  243.        7. Press menu. Wait. Ready.
  244.  
  245.        (It is easier as it seems:just press return twice)
  246.  
  247.     type 2: photomorphing, mixing and movie-making of two pictures:
  248.        This will gradually morph and mix two different images into eachother.
  249.        Both pictures must be 24 bit images and must have the same x & y size.
  250.        1. First you are asked to give the filename of a secondary (clear)
  251.           picture.
  252.        2. You are asked if you want to interpolate, if no, you will be doing
  253.           a type 2 morphing, so the 'Y'.
  254.        3. The number of steps is asked. If you want to make a movie, take
  255.           at least 8 steps. Note you can have 73 steps at most, because only
  256.           77 files may be in one directory.
  257.        4. The filename is asked. A directory with this name will be created,
  258.           containing:<dir>.sec.   <dir>.mix.   <dir>.spr. and <dir>.Points
  259.        5. You are asked to load a point file. This is a file, describing
  260.           the transformation. Use this only if you have a point file for
  261.           this particular picture.
  262.        6. You are now ready to set the transformation. Press select somewhere
  263.           in the picture, (keep holding it), move the mouse and let go. The
  264.           point you just pointed at, will be moved along the line. If you
  265.           want a nice morphing, make that items in the first picture cor-
  266.           respond with the same item in the second: e.g. connect eyes, top
  267.           of the nose, middle of the mouth, ears, etc, etc. You can use adjust
  268.           to move points around.
  269.        7. Press menu. Wait. Ready. Note that morphing may use a huge amount
  270.           (temporary) on your hard-disc: 3*steps*size of picture and a
  271.           'disc full' error is fatal.
  272.  
  273.     Making movies:
  274.        When type 1 morphing, you will find your pictures in the named
  275.        directory, named 000, 001, etc., one which is a link. When type 2
  276.        morphing you will find your pictures in <dir>.mix., named 000, 001,
  277.        etc., two of which are links. Use !Translator to convert these
  278.        pictures to sprites. Save the sprites in <dir>.spr. Use
  279.        !MaskUtils.!Rename to rename the internal sprite names. Place all
  280.        the sprites in one spritefile, using paint and save. You now have
  281.        an animation file, which can be used by !MaskUtils.!Animator. Very
  282.        nice results can be made if you do your best!
  283.  
  284. bwrgbpcygRB:
  285.     Set the color for a masked-out part. When saving, this color will be
  286.     approximated by the best fitting color in the palette.
  287.  
  288. Shift-select in the top-left window will draw a line. The color of this
  289.     line is changed gradually from point a to point b. You should only
  290.     use this option, if you can see separate pixels. The option can be
  291.     very useful when erasing things. Currently this works only for 24 bit
  292.     images.
  293. *********************************DISPLAY & OPTIONS*************************
  294. zoom:      zoom to the currently selected point
  295. unzoom:    zoom out
  296. mask       Zoom into the selected mask
  297. X          Show full image
  298. arrows     Move through picture
  299. DMA        Turns dma off in large calculations. Applies for: morph, edge,
  300.            ChngCol,Erase,Contrast. You can set it on startup changing the
  301.            !Mask.!Defaults file.
  302. FD         Fast display. This turns dithering off. You can set it on startup
  303.            by changing the !Mask.!Defaults file.
  304. PAL        Toggle between the two selectable palettes.One is the default
  305.            palette, the other is:BGGRRRBG. This gives a somewhat better
  306.            picture in most cases. You can select it on startup by changing
  307.            the !Mask.!Defaults file.
  308. UNDO       toggle undo on/off. When on, before the main image is changed, it
  309.            is saved as <Wimp$ScrapDir>.MaskBackup  The image is not saved
  310.            after inverting. The default undo-setting is set in the
  311.            !Mask.!Defaults file.
  312. *********************************HIDDEN OPTIONS****************************
  313. You are not supposed to use these options:
  314. ñ   Do a speed test for displaying        (it will mess up your screen)
  315. T   Tidy the memory map
  316. ú   Show memory map                       (it will mess up your screen)
  317. V   Show info+version number
  318. |   Test new memory routine
  319. \   Test compression routines             (it will mess up your screen)
  320. J,K Find out yourself
  321. *********************************GENERAL***********************************
  322. General (tips, etc.):
  323. 1)  Because images will usually be displayed smaller than the original,
  324.     some pixels will not be visible. So even if the mask looks solid, there
  325.     may be some gaps in it. To fill up singular gaps in the mask you can
  326.     use 'dilation 8'. Excessive pixels can be removed by 'noise 1'.
  327. 2)  If you want to select more than one group in the down-left window, you
  328.     can try the following:
  329.     Surround the groups by using the menu-button. (make sure they are fully
  330.     surrounded or they will disappear!). Shift-select in a masked-out
  331.     (black) part. Wait a second. Shift-select again at the same place, and
  332.     if you are lucky, your groups will be isolated. Using this method
  333.     multiple times can yield better results.
  334. 3)  The screenmode is set in the file '!Mask.!Defaults'. Change this file
  335.     to your own preferences. The screenmode has to have 256 colors and a
  336.     size of at least 640 by 256 pixels.
  337. 4)  The icon sprite was, ofcourse, made with this program.
  338. 5)  Depending on the available memory, you can have up to 6 mask at a time.
  339.     You can select the mask by pressing the arrows (if they are there).
  340.     If there is just enough memory for only one mask, it will be very
  341.     difficult to produce good results, so save a part of the picture and
  342.     edit that, or give the program more memory.
  343. 6)  If there is not enough memory for even one mask, the only thing you can
  344.     do is to view the picture. Making a mask will generate some fatal
  345.     error message or even kill your computer.
  346. 7)  This program has been written on a 2Mb A3000 with arm3 and RO3.10 and
  347.     should work on all other arm based machines.
  348. 8)  Some buttons have key-shortcuts:
  349.     L load         A and         = =
  350.     S save         O or          E eor
  351.     0 clear        1 set         N not
  352.     Z zoom to mask X show full   D zoom in
  353.     C zoom out     M Morph
  354.  
  355. If anybody wants to write a (semi-) riscos version of this program, please
  356. do so, but tell me first, so I can prevent multiple people doing the same
  357. thing.
  358.  
  359. next versions:
  360. This program is a collection of things that I liked to do and were quite
  361. easy to do in the context of this program. This will not change in the
  362. future.
  363. Michel Grimminck 23 may 1993
  364.  
  365. Email:grimmink@phys.uva.nl
  366. Smail:westerstraat 155▓
  367.       1015 MA Amsterdam
  368.       The Netherlands
  369. ------------------------------------------------------------------------
  370. APPENDIX A |
  371. ¡¡¡¡¡¡¡¡¡-¡/
  372. 4-connectivity: the points marked by * are all 4-connected to P
  373. 8-connectivity: the points marked by + are all 8-connected to P
  374. ╖╖╖╖╖╖╖             ╖╖╖╖╖╖╖
  375. ╖╖╖*╖╖╖             ╖╖+++╖╖
  376. ╖╖*P*╖╖             ╖╖+P+╖╖
  377. ╖╖╖*╖╖╖             ╖╖+++╖╖
  378. ╖╖╖╖╖╖╖             ╖╖╖╖╖╖╖
  379. -------------------------------------------------------------------------
  380. APPENDIX B |
  381. ¡¡¡¡¡¡¡¡¡-¡/
  382. Things that cannot be done with paletted files:
  383. 1)load:back   Load file as background
  384. 2)Color operations, unless the palette allows it
  385. 3)Erase       Erase if in mask
  386. 4)Set color of masked out part exactly good
  387. 5)Draw interpolated lines
  388. 6)blending    (in photomorphing)
  389. 7)sharp       Making pictures sharper
  390. 8)contrast
  391. ***************
  392. Things that cannot be done with 24 bit files:
  393. 1)24bit       Convert them to 24 bit
  394. 2)Hue         Use 'HUE' for mask criteria
  395. -------------------------------------------------------------------------
  396. APPENDIX C |
  397. ¡¡¡¡¡¡¡¡¡-¡/
  398. how to get !Translator:
  399. !TRANSLATOR is a shareware program from:
  400.  
  401. John Kortink
  402. Nutterbrink 31
  403. 7544 WJ Enschede
  404. The Netherlands
  405.  
  406. or send email to john@dialis.hacktic.nl
  407.  
  408. Payment NOTE
  409. ------------
  410. Payment in CASH ONLY PLEASE, in any currency, for the equivalent of 35 dutch
  411. guilders (England ú10). The only exceptions may be (in order of preference) :
  412.  
  413. a) A Eurocheque, for 35 dutch guilders, *with* pass-number on the back
  414. b) Postal exchange for 35 dutch guilders
  415. c) Any other form of payment, which gets charged by the bank, but which I'm
  416.    happy to accept if I end up with 35 dutch guilders after bank charges.
  417.    Typical bank charges are ú8 on any non-a) payment.
  418. (the above was written by John Kortink)